#pragma once

// the system message on explorer restart
const UINT MsgTaskbarCreated						= ::RegisterWindowMessage(_T("TaskbarCreated"));

/**
 *  CSimpleTray is a class used to add tray icon feature to an application.
 */
class CSimpleTray  
{
public:
	/**
	*  Constructor.
	*/
	CSimpleTray(UINT uiTrayNotificationMessage);

	/**
	*  Destructor.
	*/
	virtual ~CSimpleTray();

	/**
	*  Shows the tray icon.
	*
	*  \return void.
	*/
	bool Show();

	/**
	*  Hides the tray icon.
	*
	*  \return void.
	*/
	void Hide();

	/**
	*  Sets the icon to be used.
	*
	*  \return void.
	*/
	void SetIcon( HICON hIcon );

	/**
	*  Sets the tooltip.
	*
	*  \return void.
	*/
	void SetTooltip( LPCTSTR lpTooltip );

	/**
	*  Tray icon should be visible?
	*  Useful on explorer restart (MsgTaskbarCreated)
	*/
	BOOL IsEnabled();

private:

	BOOL m_bEnabled;		/**< TRUE if the icon is visible, FALSE otherwise */
	HICON m_hIcon;			/**< Handle to the icon */
	NOTIFYICONDATA m_nid;	/**< NOTIFYICONDATA structure */
	CString m_strTooltip;	/**< Tooltip to show when mouse is over the icon */
	UINT m_uiTrayNotificationMessage;
};
